#ifndef USERINFODIALOG_H_
#define USERINFODIALOG_H_

#include <map>
#include <wx/wx.h>
#include <wx/richtext/richtextctrl.h>
#include "../../core/Buddy.h"
#include "../../core/interfaces/iModule.h"
#include "../../core/interfaces/iUserInterface.h"
#include "../../core/events/ImppCommandEvent.h"
#include "../../core/events/BuddyChangedEvent.h"

namespace Impp
{

#define STD_USERINFO_MODULE_NAME 			wxT("StdUserinfoModule")
#define STD_USERINFO_MODULE_ACTION_SHOW 	wxT("showUserInfo")

struct Info{

	Info(const wxString & name, const wxString & formatString, std::map<wxString, wxString>* valueList = NULL){
		this->name = name;
		this->formatString = formatString;
	}

	wxString name;
	wxString formatString;
	std::map<wxString, wxString>* valueList;
};

struct Category{
	wxString displayName;
	std::vector<Info> infos;
};

class UserInfoDialog : public wxFrame
{
private:
	Buddy* buddy;
	wxRichTextCtrl* infos;
	static std::vector<UserInfoDialog*> openedWindows;

public:
	UserInfoDialog(wxWindow* parent, Buddy* buddy);
	virtual ~UserInfoDialog();

	static void updateOpenWindows(Buddy* buddy);

private:
	void update(Buddy* buddy);
	void writeIn(const Category & cat);
};


class StdUserInfoDialogModule : public iModule{

	DECLARE_DYNAMIC_CLASS(StdUserInfoDialogModule)

public:
	StdUserInfoDialogModule(){};
	virtual ~StdUserInfoDialogModule(){};

	void moduleInit();
	void moduleDestroy();

	void onImppCommand(ImppCommandEvent & event);
	void onBuddyChanged(BuddyChangedEvent & event);
	static void wxCALLBACK addBuddyMenuItem(iMenu* menu, Buddy* buddy);

};

}

#endif /*USERINFODIALOG_H_*/
